package ui.views.property;

import org.eclipse.ui.views.properties.IPropertyDescriptor;
import org.eclipse.ui.views.properties.IPropertySource;
import org.eclipse.ui.views.properties.PropertyDescriptor;
import org.eclipse.ui.views.properties.TextPropertyDescriptor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import ui.tempdao.EgnRstScenarioDao;
import dao.EgnRstScenarioId;

public class ScenarioProp implements IPropertySource{
	private final static Logger logger = LoggerFactory.getLogger(ScenarioProp.class);
	private EgnRstScenarioId sceId;
	private String sceSetId;
//	private Boolean flag;
	
	public ScenarioProp() {
	}
	public ScenarioProp(EgnRstScenarioId sceId) {
		this.sceId =sceId;
		this.sceSetId =EgnRstScenarioDao.getEgnRstScenaioSetId(sceId);
	}

	@Override
	public Object getEditableValue() {
//		return this;
		return null;
		
	}
	
	@Override
	public IPropertyDescriptor[] getPropertyDescriptors() {
		TextPropertyDescriptor sceSetDesc = new TextPropertyDescriptor(sceSetId, "01.SceSetId");
//		ComboBoxPropertyDescriptor sceDesc = new ComboBoxPropertyDescriptor(sce.getSceId(), "02.SceId", new String[]{"AAA","BBB"});
		PropertyDescriptor sceDesc = new PropertyDescriptor(sceId, "02.SceId");
//		TextPropertyDescriptor mvDesc = new TextPropertyDescriptor(sce.getMarketVari(), "03.MarketVariable");
//		PropertyDescriptor coefficientDesc = new PropertyDescriptor(sce.getCoefficient(), "04.Coefficient");

//		Grouping Property
		sceSetDesc.setCategory("Label");
		sceDesc.setCategory("Label");
		
		
		IPropertyDescriptor[] propDesc = new IPropertyDescriptor[] {
				sceSetDesc
				,sceDesc
//				,mvDesc
//				,coefficientDesc
				};
		
		return propDesc;

	}
	
	@Override
	public Object getPropertyValue(Object property) {
		if (sceSetId.equals(property)) {
			return sceSetId;
		}
		else if (sceId.equals(property)) {
			return sceId.getSceId();
		}
//		else if (sce.getMarketVari().equals(property)) return sce.getMarketVari();
//		else if (((Double)sce.getCoefficient()).equals(property)) return sce.getCoefficient();

		return null;
	}
	
	@Override
	public void setPropertyValue(Object id, Object value) {
//		if (sceSetId.equals(id)) {
//			sceSetId=((String)value);
//		}
//		else if (sce.getSceId().equals(id)) sce.setSceId((String)value);
//		else if (sce.getMarketVari().equals(id)) sce.getMarketVari((String)value);
	}
	
	@Override
	public boolean isPropertySet(Object id) {
		return false;
	}
	
	@Override
	public void resetPropertyValue(Object id) {
//		if(flag){
//			setPropertyValue(id,"aaa");
//		}
	}


}
